<?php
/**@package     Joomla.Site
 * @subpackage  mod_booking
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt*/
defined('_JEXEC') or die;
$type 		= $params->get('type',	1);
$lang = JRequest::getVar('lang','');
$Itemid = JRequest::getVar('Itemid','101');
$db = JFactory::getDBO();
if($type==0){
	$sqlcat="SELECT * from #__menu where menutype='career' and published=1";
	$db->setQuery($sqlcat);
	$rowcats = $db->loadObjectList();
?>
<div class="categoriesjob">
	<h4 class="titleh4"><?php echo JText::_('Categories');?></h4>
    <ul class="">
	<?php
    for($i=0;$i<count($rowcats);$i++){
		$catidvacancy = $rowcats[$i]->link;
		$catidvacancy = explode('&id=',$catidvacancy);
		$catidvacancy = $catidvacancy[1];
		$sqlvacancy="SELECT * from #__content where catid='".$catidvacancy."' and state=1";
		#$date =  date("Y-m-d H:i:s");
		#$sqlvacancy="SELECT * from #__content where catid='".$catidvacancy."' AND state=1 AND ((publish_up <= '".$date."' AND publish_down >= '".$date."') OR (publish_up = '0000-00-00 00:00:00' AND publish_down = '0000-00-00 00:00:00') OR (publish_up <= '".$date."' AND publish_down = '0000-00-00 00:00:00')) order by ordering asc";


		$db->setQuery($sqlvacancy);
		$rowvacancys = $db->loadObjectList();
		if(count($rowvacancys)<=0){
			$linkcat = "javascript:void(0)";
		}
		else{
			$linkcat = $rowcats[$i]->link.'&Itemid='.$rowcats[$i]->id;
		}
	?>
    	<li><a href="<?php echo $linkcat;?>"><?php echo $rowcats[$i]->title;?> (<?php echo count($rowvacancys);?>)</a></li>
    <?php
	}
    ?>
    </ul>
</div>
<?php
}
if($type==1){
?>
1
<?php
}
if($type==2){
?>
2
<?php
}
?>
